package GUI;
import processing.core.PImage;


public class PlusMinusButton extends Component {
	boolean pluState;
    public boolean pressed;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	public PlusMinusButton()
	{
		super();
		pluState=true;
		width=10;
		height=10;
	}

	public void draw()
	{
		Utils.globalProcessing.rectMode(Utils.globalProcessing.CORNER);
		Utils.globalProcessing.textFont(Utils.plotFont, 19);
		Utils.globalProcessing.stroke(128);
		Utils.globalProcessing.strokeWeight(1);
		if(pluState)
		Utils.globalProcessing.line(x+(int)((float)width/2 + 0.5), y, x+(int)((float)width/2 + 0.5), y+height);
		Utils.globalProcessing.line(x, y+(int)((float)height/2 + 0.5), x+width, y+(int)((float)height/2 + 0.5));

		int cx = x;
		int cy = y;

			Utils.globalProcessing.textAlign(Utils.globalProcessing.LEFT);

			if(mouseOver()) 
			{
				super.draw();
				if(Utils.globalProcessing.mousePressed)
				{
					//gu.drawVGradient(x, y + height, width, -height, color(150, 150, 180), 80, color(150, 150, 180), 255, 0.8);    
					Utils.gu.drawBox(x, y, width, height, 0, Utils.globalProcessing.color(150, 150, 200), 255);
					Utils.gu.drawBox(x, y, width, height, 1, Utils.globalProcessing.color(150, 150, 200), 150);
					
					cx += 2;
					cy += 2;
					pressed = true;
				}
				else if(pressed)
	            {
	                pressed = false;

	                if(pluState)
	                	pluState = false;
	                else pluState = true;

	            }
			}
			 else
		        {
		            pressed = false;
		        }

		
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////
	PImage icon;
	String label;

	public void mouseCliked() {
		if(pluState)
			pluState=false;
		else pluState=true;
	}
}
